<template>
  <div class="dashboard-container">
    <img src="../../assets/404_images/404.png" alt="">
    <div class="dashboard-text">name: {{ this.customer.user.realName}}</div>
    <el-input v-model="customer.user.realName" placeholder="请输入内容"></el-input>

    


   <el-table
      :data="tableDat"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="层次id"
        width="180">
      </el-table-column>
      <el-table-column
        prop="itemCode"
        label="层次编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="itemName"
        label="层次名称">
      </el-table-column>
      <el-table-column
        prop="orderNo"
        label="层次顺序">
      </el-table-column>
    </el-table>


   <div class="block">
  <span class="demonstration">页数较少时的效果</span>
  <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage2"
      :page-sizes="[5, 10, 20, 30]"
      :page-size="5"
      layout="sizes, prev, pager, next"
      :total="31">
    </el-pagination>
</div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { login,getInfo,logout } from '@/api/user'
import { getLevelList} from '@/api/level'
export default {
  name: 'Dashboard',
  data(){
    return {
      // url:"../static/img/404.a57b6f31.png",
      url:'../../assets/404_images/404.png',
      user:{
       userName:"test01",
        passWord:"123456"
      },
      customer:{
        user:{
          realName:"12334"
        }
      },
      levelPage:{
             pageSize: 5,
              pageNo: 1,
              currentPage:1,
             } 
      ,tableDat:[]
    }
    
  }   
  ,
  created () {
    login(this.user)
    getLevelList(this.levelPage).then(ress=>{
      this.tableDat=ress.data.resultList;
    })
    
  }
  ,
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  methods: {
     handleSizeChange(val) {
      this.levelPage.pageSize=val
    },
    handleCurrentChange(val){
     this.levelPage.currentPage=val
     this.levelPage.pageNo=this.levelPage.pageSize*(this.levelPage.currentPage-1)+1
      getLevelList(this.levelPage).then(ress=>{
      this.tableData=ress.data.resultList;
      console.log(this.tableData)
    })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
